/**
 * 商品管理列表混入信息
 * */
import { mapState, mapMutations } from 'vuex'
import { ApiRequest } from '@api/basePage'

export default {
    data () {
        return {
            dynamicData: {},
            pagePath: '', // 当前路由
            formData: {}, // 表单提交数据
            auditType: '0' // 审核类型
        }
    },
    computed: {
        ...mapState('admin/baseList', [
            'listData',
            'formItemData',
            'formItemDataRules'
        ])
    },
    created () {},
    methods: {
        ...mapMutations('admin/baseList', [
            'setListData',
            'setFormItemData',
            'setFormItemDataRules'
        ]),
        // 获取表格数据
        getData (formData) {
            let params = {
                auditType: this.auditType,
                ...formData
            }
            this.$refs.table.getData(params)
        },
        handleAgree () {
            let data = {
                uuid: this.uuid
            }
            // 开始请求商品列表
            ApiRequest(
                this.requestApi.toAudit.url,
                this.requestApi.toAudit.type,
                data
            ).then(res => {
                this.aloading = false
                this.$Message.success('审核成功')
            })
        },
        handleRefuse () {
            // 开始请求商品列表
            ApiRequest(
                this.requestApi.toAudit.url,
                this.requestApi.toAudit.type,
                {}
            ).then(res => {
                this.aloading = false
                this.$Message.success('审核成功')
            })
        },
        // 组件内数据改变
        handleChangeFormData (data) {
            this.$set(this.$data, 'formData', data)
        },
        // 点击TAB切换页面显示
        tabsHandleChange (obj) {
            this.auditType = obj.name
            this.getData()
        }
    }
}
